def flag(fg: bool) -> dict:
    if fg:
        return ok()
    else:
        return error()


def ok(data: object = None) -> dict:
    return {
        "code": 200,
        "message": "ok",
        "data": data
    }


def error(code: int = 500, message: str = "error") -> dict:
    return {
        "code": code,
        "message": message
    }


def page_table(data: object = None, total: int = 0, current_page: int = 1, page_total: int = 0) -> dict:
    return {
        "code": 200,
        "message": "ok",
        "data": data,
        "total": total,
        "page_total": page_total,
        "current_page": current_page,
    }
